#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int arr[N];
int n;
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
	}
	int ans = 0;
	for (int i = n - 1; i >= 0; i--) {
		if ((ans + arr[i]) % 2 == 0) {
			ans = (arr[i] + ans) / 2;
		}
		else {
			ans = (arr[i] + ans) / 2 + 1;
		}
	}
	cout << ans << endl;
	return 0;
}